<?php 
include TMPL_PATH.'public/header.phtml';
?>
<style type="text/css">
td{
	border-left:1px solid #9CF;
}
</style>
<?php if(!$_REQUEST['is_ajax']):?>
<div class="subnav">
    <div class="content-menu ib-a blue line-x" style="overflow:hidden;">
    	<div style="float:left;margin-right:50px;">
        <a href='<?php echo U('user/user_list');?>'><em>会员列表</em></a><span>|</span>
        <a href='javascript:;' class="on" ><em>身形数据</em></a>
      </div>
              <div style="color:#000;">
       会员邮箱：<?php //echo $user['username'];?><?php echo $user['email'];?>  &nbsp; &nbsp; &nbsp;
       (注:修改记录中 shoulder,chest_type,stomach_type,posture 显示的数据为用户修改之前的选项数据)
      </div>
    </div>
</div>
<?php endif;?>
<div class="pad_10">

<div class="table-list">
    <table width="100%" cellspacing="0" >
        <thead>
<tr>
            <th align="left">量体方式</th>
            <th align="left">profile name</th>
                <?php  foreach($measure_field as $k1 => $v1):?>
                    <th align="left"><?php echo $v1['measure_field'];?></th>
                 <?php endforeach;?>
                <th align="left">上衣尺码</th>
                <th align="left" style="width:60px">裤子尺码</th>
                <th align="left">更新时间</th>
                <th></th>

            </tr>
        </thead>
     <tbody>
   <?php 
        if(isset($measure_infos)):
   		foreach ($measure_infos as $k=>$v):
   ?>
			<tr>
                            <td style="text-align:center;width:60px">
                             <?php                                     
                                    if($v['m_status'] == 1){
                                        echo '量尺量体';
                                    }else if($v['m_status'] == 2){
                                        echo '免量体';
                                    }else if($v['m_status'] == 3){
                                        echo '拍照量体';
                                    }else if($v['m_status'] == 4){
                                        echo '量尺并拍照';
                                    }?>
                            </td>
                            <td align="left"><?php echo $v['measure_name'];?></td>
                    <?php  foreach($measure_field as $k1 => $v1):
                          if($v1['field_type']!= 'type' && $v['m_status'] == 2 && !in_array($v1['measure_field'],array('age','weight','height'))){
                              echo '<td></td>';
                              continue;
                          }
                          if($v['m_status'] == 3 && !in_array($v1['measure_field'],array('age','weight','height'))){
                              echo '<td></td>';
                              continue;
                          }
                        ?>
                            <td style="text-align:center;">
                                <?php 
								    if($v1['field_type'] == 'type') $v1['field_type'] = "";
                                    echo $v[$v1['measure_field']].$v1['field_type']; 
                                ?>  
                            </td>
                    <?php endforeach;?>
                            <td style="text-align:center;"><?php echo $v['clothes_size'];?></td>
                            <td style="text-align:center;"><?php echo $v['pants_size'];?></td>

                            <td align='left'>
							<?php echo date('Y-m-d H:i:s',$v['update_time']);?>
                            <?php if($v['is_edit_new']){echo '<font color="#009900">new</font>';}?>
                            </td>
                            <td width="25px;">
                            <?php if($v['edit_data']):?>
                                <a href="javascript:void(0);" onclick="mInfoListShow(this,<?php echo $k; ?>);" class="as" >展开</a>
                                <br />
							<?php endif;?>
                            <a href="javascript:addPhoto(<?php echo $v['id']; ?>);">照片</a>
                            </td>
            </tr>
            <?php if(($v['m_status'] == 3 || $v['m_status'] == 4) || ($v['front_img'] && $v['side_img'])):?>
            <tr><td colspan="3"></td><td colspan="2">正面照片</td><td colspan="7"><img width=200 src="<?php echo $v['front_img']?>"/></td><td colspan="3">侧面照片</td><td colspan="10"><img width=200 src="<?php echo $v['side_img']?>"/></td></tr>
            <?php endif;?>
            <?php  foreach($v['edit_data'] as $ek => $ev):?> 
            <tr  style="display:none;<?php if((time()-$ev['edit_time'])<(3600*24*7)){echo 'background-color:#9F6;';}?>" class="tr_<?php echo $k; ?> trs" >
                    <td>|__</td>   <td align='left'><?php echo $ev['type']==0 ? '客户自己修改': '客服修改';?></td>
                <?php  foreach($measure_field as $k1 => $v1):?>
                        <td style="text-align:center;">
                            <?php 
                               $e_val = isset($ev[$v1['measure_field']]) ? $ev[$v1['measure_field']] : ''; 
							   echo floatval($e_val)>0 ? '+'.$e_val : $e_val;
                            ?>  
                        </td>                     
                <?php endforeach;?><td></td><td></td>
                       <td align='left'><?php echo date('Y-m-d H:i:s',$ev['edit_time']);?></td> 
                       <td></td>
            </tr>
            <?php  endforeach;?>
	<?php 
        endforeach;
		else:
		echo '<tr><td colspan="12" align="center">无身型数据</td></tr>';
		endif;
	?>
   </tbody>
    </table>
  <div id="pages"><?php echo $pageShow;?></div>
  
</div>

</div>
</body>
</html>
<script type="text/javascript">
<!--
function addPhoto(mid){
	window.top.art.dialog({id:'add',iframe:'<?php echo U('user/measure_photo')?>&mid='+mid, title:'身型照片设置', width:'700', height:'400'}, function(){var d = window.top.art.dialog({id:'add'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'add'}).close()});void(0);
}
</script>
<script type="text/javascript">
function mInfoListShow(obj,id){
    if($(obj).text() == '关闭'){
        $('.tr_'+id).hide();$(obj).text('展开'); 
    }else{
    	/*$('.trs').hide();$('.as').text('展开')*/
		if($('.tr_'+id).css('display')=='none'){
	        $('.tr_'+id).show();$(obj).text('关闭'); 
	    }else{
	    	$('.tr_'+id).hide();$(obj).text('展开'); 
	    }
    }
}
</script>